package com.chen.script.job;

import com.chen.base.utils.BashUtil;
import com.chen.script.annotation.Job;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @Author: 陈锦龙
 * @Date: 2025/3/21 14:04
 */
@Data
@Slf4j
@Component
@ConfigurationProperties(prefix = "windows")
@ConditionalOnProperty(value = "windows.enable", havingValue = "true")
public class WindowsDateTimeEditJob {

    public String batFilePath;

    public WindowsDateTimeEditJob(){
        log.info("初始化 修改Windows系统时间 JOB");
    }

    @Job(value = "windows")
    public void run() {
        log.info("修改Windows系统时间");
        BashUtil.execBatScript(batFilePath);
    }
}
